//
//  CalReminder.m
//  Pocket Doctor alpha version
//
//  Created by Sherif, Yin, Taylor, Jacob, Anna, Mike on 11-11-22.
//  Copyright (c) 2011 __Sytjam__. All rights reserved.
//
//Class Description: gets the name and date of reminders.
//
//Known Bugs: none.
//

#import "CalReminder.h"



@implementation CalReminder
@synthesize date, name;

+ (CalReminder *)reminderNamed:(NSString *)name date:(NSDate *)date;
{
    return [[[CalReminder alloc] initWithName:name date:date] autorelease];
}

- (id) initWithName:(NSString *)aName date:(NSDate *)aDate
{
    if ((self = [super init])) {
        name = [aName copy];
        date = [aDate retain];
    }
    return self;
}

- (NSComparisonResult) compare:(CalReminder *)otherReminder
{
    NSComparisonResult comparison = [self.date compare:otherReminder.date];
    if(comparison == NSOrderedSame)
    {
        return [self.name compare:otherReminder.name];
    }
    else
    {
        return comparison;
    }
}

- (void) dealloc
{
    [date release];
    [name release];
    [super dealloc];
    
}
@end
